<!--
 * @Date: 2022-04-13 21:21:08
 * @LastEditors: sailornpg
 * @LastEditTime: 2022-04-18 22:16:09
 * @FilePath: \weibovue\src\views\FollowListShow\index.vue
 * @Description: 关注列表显示
-->
<template>
  <div v-if="count != 0">
    <div v-for="(user, index) in followList.userList" :key="index">
      <fans-and-following-card
        :userInfo="user.user"
        :is-my-following="true"
      ></fans-and-following-card>
    </div>
  </div>
  <div v-else>
    <el-empty description="还没有关注的人哦~快去关注吧！" />
  </div>
</template>
<script lang="ts" setup>
import { getCurrentInstance, onMounted, ref } from "vue";
import { useRoute } from "vue-router";
import { followListType } from "../../components/createWeiBo/types";
import fansAndFollowingCard from "../../components/fansAndFollowingCard/index.vue";
const route = useRoute();
const { $api } = getCurrentInstance()!.appContext.config.globalProperties!;
let count = ref<number>(0);
//关注列表
let followList = ref<followListType>({});
//获取关注列表
const getFollowingList = async (id: number) => {
  let res = await $api.user.reqFollowingList(id);
  // console.log(res);
  if (res.code == 200) {
    count.value = res.data.count;
    followList.value.userList = res.data.userList;
  }
};
onMounted(() => {
  const id = route.params.id;
  getFollowingList(+id);
});
</script>
<style lang="less" scoped></style>
